<script>
function member_submit() {
    //用户名
    if(!isempty('account','<?=lang('member_yhmbnwk')?>'))return false;
    <?php if($debug!='true'):?>
    //密码验证
    if(!isempty('password','<?=lang('member_mmbnwk')?>'))return false;
    var oldpwd = $("input[name=password]").val();
    var newpwd = $("input[name=newpwd]").val();
    if(oldpwd == newpwd){
        alert('新密码不能和旧密码一样');
        return false;
    }
    if(!isempty('verifypwd','<?=lang('member_qrmmbnwk')?>'))return false;
    if($("input[name=newpwd]").val() != $("input[name=verifypwd]").val()){
        alert('<?=lang('member_srdmmbyz')?>');
        return false;
    }
    <?php endif; ?>
	return true;
}

$(function(){
    $("input[name=account]").blur(function(){
        var account = $(this).val();
        if($.trim(account)=='')return;
        $.get("<?=blang_url('home/valid_account')?>",{account:account}, function(status){
            if(status == 0){
                $("input[name=account]").focus();
                $("#accountTips").text('('+account+') 用户不存在');
            }else{
                $("#accountTips").text('');
            }
        });
    });

    <?php if($debug!='true'):?>
    $("input[name=password]").blur(function(){
        var account = $("input[name=account]").val();
        var password = $("input[name=password]").val();
        if($.trim(account)=='' || $.trim(password)=='')return '';
        $.get("<?=blang_url('home/valid_pwd')?>",{account:account,password:password}, function(status){
            if(status == 0){
                $("input[name=password]").val('').focus();
                $("#pwdTips").text('原始密码错误');
            }else{
                $("#pwdTips").text('');
            }
        });
    });
    <?php endif;?>
})

</script>

<!--top结束-->
<div class="mian">
	<div class="mian1">
		<div class="mian2">
			<!--right start-->
			<div class="right">
				<!-- contents start -->
				<div id="contents">
					<div id="contents_container">
					<form action="<?=blang_url('home/'.$post_type)?>" method="post" name="memberform" onsubmit="return member_submit()" autocomplete="off" >
						<table cellpadding="0" cellspacing="0" id="table_forms" border="1">
						    <tr>
						      <td class="forms_left"><span>*</span><?=lang('member_yhm')?>:</td>
						      <td>
                                  <input type="text" name="account" value="<?=$account?>" />
                                  <span id="accountTips" style="margin-left: 15px;color: red;"></span>
                              </td>
						    </tr>
                            <?php if($debug!='true'):?>
						    <tr >
						      <td class="forms_left"><span>*</span>原始密码:</td>
						      <td>
                                  <input type="password" name="password"  />
                                  <span id="pwdTips" style="margin-left: 15px;color:red;"></span>
                              </td>
						    </tr>
                            <?php endif;?>
						    <tr >
						      <td class="forms_left"><span>*</span>新密码:</td>
						      <td><input type="password" name="newpwd" /></td>
						    </tr>
                            <tr >
                                <td class="forms_left"><span>*</span>确认新密码:</td>
                                <td><input type="password" name="verifypwd" /></td>
                            </tr>
						    <tr>
						      <td align="center" colspan="2" class="sub_padding_right">
                                  <input type="<?=$debug?'text':'hidden'?>" name="debug" value="<?=$debug?>" />
								<input type="submit" value="<?=lang('public_tj')?>" name="submits" style="margin-right: 20px;width: 150px; height: 30px;"/>
                                <input type="button" value="<?=lang('member_qdl')?>" onclick="location.href='<?=blang_url()?>'" />
						      </td>
						    </tr>
					   </table>
					</form>
				   </div>
				</div>
				<!-- contents end -->
			</div>
			<!--right end-->
		</div>
	</div>
</div>

